    	$(function(){
    		var key = getcookie('doutingshop');
			$(".address-ocnt").citySelect({required:false});
			$.sValid.init({
                rules:{
                    true_name:"required",
                    mob_phone:"required",
                    prov_select:"required",
                    city_select:"required",
                    region_select:"required",
                    address:"required"
                },
                messages:{
                    true_name:"姓名必填！",
                    mob_phone:"手机号必填！",
                    prov_select:"省份必填！",
                    city_select:"城市必填！",
                    region_select:"区县必填！",
                    address:"街道必填！"
                },
                callback:function (eId,eMsg,eRules){
                    if(eId.length >0){
                        var errorHtml = "";
                        $.map(eMsg,function (idx,item){
                            errorHtml += "<p>"+idx+"</p>";
                        });
                        $(".error-tips").html(errorHtml).show();
                    }else{
                         $(".error-tips").html("").hide();
                    }
                }  
            });
    		$('.add_address').click(function(){
                if($.sValid()){
        			
        			var true_name = $('input[name=true_name]').val();
        			var mob_phone = $('input[name=mob_phone]').val();
        			var tel_phone = $('input[name=tel_phone]').val();
        			var province = $('select[name=prov]').val();
                    var city_id = $('select[name=city]').val();
        			var area_id = $('select[name=region]').val();
        			var address = $('input[name=address]').val();
        			
        			var DeliveryAddress = {
                        consignee:true_name,
                        phone:mob_phone,
                        addProvince:province,
                        addCity:city_id,
                        addDistrict:area_id,
                        address:address,
                        defaultAddress:1
                    };
                    //ajax 提交收货地址
                    $.ajax({
                        type:'post',
                        url:ApiUrl+'/user/eb/addDeliveryAddress',
                        contentType: "application/json",
                        data: JSON.stringify(DeliveryAddress),
                        dataType:'json',
                        success:function(result){
                            checklogin(result.rspCode);
                            if(result.rspCode==0){
                                if(result){
                                    location.href = WapSiteUrl+'/tmpl/member/address_list.html';
                                }else{
                                    location.href = WapSiteUrl;
                                }
                            }
                        }
                    });
                }
    		});
    		
    	});